package com.jeesite.modules.digitalize.constants;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum TaskReviewStatusEnum {

    WAIT_AUDIT(0, "待审核"),
    IN_PROGRESS(1, "进行中"),
    COMPLETED(2, "已完成"),
    REJECTED(3, "已驳回");

    public static final String INFO = "0待审核 1进行中 2已完成 3已驳回 ";

    private final Integer code;
    private final String desc;

    TaskReviewStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static TaskReviewStatusEnum getByCode(Integer code) {
        if (code != null) {
            return Arrays.stream(TaskReviewStatusEnum.values())
                    .filter(item -> item.code.equals(code))
                    .findFirst()
                    .orElse(null);
        }
        return null;
    }
}
